package Beans;

import javax.servlet.http.HttpServletRequest;

public class BrowserDescriptionBean implements java.io.Serializable
{
	private static final long serialVersionUID = 1L;
	
	public BrowserDescriptionBean() {}
	
	private String userAgent;
	private HttpServletRequest request;
	private String cssClass = "";

	public String getUserAgent() {
		return userAgent;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}
	
	public void calculate() {
		userAgent = request.getHeader("User-Agent");
		String userALC = userAgent.toLowerCase();
		if(userALC.indexOf("msie") != -1)
		{
			cssClass += "IE";
			if(userALC.indexOf("msie 8.0") != -1) {
				cssClass += " IE8";
			} else if(userALC.indexOf("msie 7.0") != -1) {
				cssClass += " IE7";
			} 
		}
		else if(userALC.indexOf("applewebkit") != -1) {
			cssClass = "CHROME";
		}
	}

	public String getCssClass() {
		return cssClass;
	}
}
